package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @author zhangkai
 * @date 2023/8/10 17:17
 */
public class HWBJJ27 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] nums = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        if (nums.length == 1) {
            System.out.println(nums[0]);
            return;
        } else if (nums.length==2){
            System.out.println(Math.max(nums[0],nums[1]));
        }

        int[] dp = new int[nums.length+1];
        //
        dp[0] = 0;
        dp[1] = nums[0];
        for (int i = 2; i <= nums.length; i++) {
            dp[i] = Math.max(dp[i-1],dp[i-2]+nums[i-1]);
        }
        System.out.println(dp[nums.length]);
    }
}
